function BBSFoxSiteSetting(opt, siteaddr, sitename, newsite, listcellrow) {
    this.opt = opt;
    //this.browserutils = new BBSFoxBrowserUtils();
    //this.prefs = this.browserutils.getSubBranch('host_'+siteaddr+'.');
    this.values = [];
    this.sitename = sitename;
    this.siteaddr = siteaddr;
    if(listcellrow)
      this.listcellrow = listcellrow;
    else
      this.listcellrow = document.getElementById('defaultsiterow');

    //if(sitename=='')
    //  this.charsetTest();

    if(!newsite)
      this.getFromPref();
    else
      this.getFromUi();
}

BBSFoxSiteSetting.prototype = {
  getPrefBool: function(elementId, prefName) {
    if(!prefName) prefName = elementId;
    this.values[elementId] = localStorage['host_'+this.siteaddr+'.'+elementId];
  },

  setPrefBool: function(elementId, prefName) {
    if(!prefName) prefName = elementId;
    localStorage['host_'+this.siteaddr+'.'+elementId] = this.values[elementId];
  },

  getPrefInte: function(elementId, prefName) {
    if(!prefName) prefName = elementId;
    //this.values[elementId] = this.prefs.getIntPref(prefName);
    this.values[elementId] = localStorage['host_'+this.siteaddr+'.'+elementId];
  },

  setPrefInte: function(elementId, prefName) {
    if(!prefName) prefName = elementId;
    //this.prefs.setIntPref(prefName, this.values[elementId]);
    localStorage['host_'+this.siteaddr+'.'+elementId] = this.values[elementId];
  },

  getPrefComp: function(elementId, prefName) {
    if(!prefName) prefName = elementId;
    this.values[elementId] = this.prefs.getComplexValue(prefName, Components.interfaces.nsISupportsString).data;
  },

  setPrefComp: function(elementId, prefName) {
    if(!prefName) prefName = elementId;
    var nsIString = Components.classes["@mozilla.org/supports-string;1"]
                              .createInstance(Components.interfaces.nsISupportsString);
    nsIString.data = this.values[elementId];
    this.prefs.setComplexValue(prefName, Components.interfaces.nsISupportsString, nsIString);
  },

  getUiBool: function(elementId) {
    if(document.getElementById("option."+elementId).checked != false)
      this.values[elementId] = "1";
    else
      this.values[elementId] = "0";
  },

  setUiBool: function(elementId) {
    if(this.values[elementId]=='1')
      document.getElementById("option."+elementId).checked = true;
    else
      document.getElementById("option."+elementId).checked = false;
  },

  getUiInte: function(elementId) {
    var item = document.getElementById("option."+elementId);
    if(item.tagName.toLowerCase()=='select')
    {
      this.values[elementId] = item.options[item.selectedIndex].value;
      //alert(this.siteaddr+" "+this.values[elementId]);
    }
    else
    {
      this.values[elementId] = document.getElementById("option."+elementId).value;
    }
  },

  setUiInte: function(elementId) {
    var item = document.getElementById("option."+elementId);
    if(item.tagName.toLowerCase()=='select')
    {
      var count = item.options.length;
      for(var i=0;i<count;++i)
      {
        if(item.options[i].value == this.values[elementId])
        {
           item.selectedIndex=i;
           colorPickerOnChange(item);
           break;
        }
      }
    }
    else
    {
      document.getElementById("option."+elementId).value = this.values[elementId];
    }
  },

  getUiComp: function(elementId) {
    this.values[elementId] = document.getElementById(elementId).value;
  },

  setUiComp: function(elementId) {
    document.getElementById(elementId).value = this.values[elementId];
  },

  //getUiAccount: function(elementId) {
  //  this.values[elementId] = document.getElementById(elementId).value;
  //},

  //setUiAccount: function(elementId) {
  //  document.getElementById(elementId).value = this.values[elementId];
  //},

  getFromUi: function() {
      var opt = this.opt;
      for(var i in opt.valueBool){
        this.getUiBool(opt.valueBool[i]);
      }
      for(var i in opt.valueInte){
        this.getUiInte(opt.valueInte[i]);
      }
      for(var i in opt.valueComp){
        this.getUiComp(opt.valueComp[i]);
      }
      //for(var i in opt.valueAccount){
      //  this.getUiAccount(opt.valueAccount[i]);
      //}
  },

  setToUi: function() {
      var opt = this.opt;
      for(var i in opt.valueBool){
        this.setUiBool(opt.valueBool[i]);
      }
      for(var i in opt.valueInte){
        this.setUiInte(opt.valueInte[i]);
      }
      for(var i in opt.valueComp){
        this.setUiComp(opt.valueComp[i]);
      }
      //for(var i in opt.valueAccount){
      //  this.setUiAccount(opt.valueAccount[i]);
      //}
      opt.charsetChange();
  },

  getFromPref: function() {
      var opt = this.opt;
      //var defaultPref = this.browserutils.getSubBranch('host_default.');
      for(var i in opt.valueBool){
        try{
          this.getPrefBool(opt.valueBool[i]);
        }
        catch(e){
          /*
          //read this pref from default and save this value right now !
          this.values[opt.valueBool[i]] = defaultPref.getBoolPref(opt.valueBool[i]);
          this.setPrefBool(opt.valueBool[i]);
          */
        }
      }
      for(var i in opt.valueInte){
        try{
          this.getPrefInte(opt.valueInte[i]);
        }
        catch(e){
          /*
          //read this pref from default...
          this.values[opt.valueInte[i]] = defaultPref.getIntPref(opt.valueInte[i]);
          this.setPrefInte(opt.valueInte[i]);
          */
        }
      }
      for(var i in opt.valueComp){
        try{
          this.getPrefComp(opt.valueComp[i]);
        }
        catch(e){
          /*
          //read this pref from default...
          this.values[opt.valueComp[i]] = defaultPref.getComplexValue(opt.valueComp[i], Components.interfaces.nsISupportsString).data;
          this.setPrefComp(opt.valueComp[i]);
          */
        }
      }
      //load login data - start
      /*
      var url = (this.siteaddr == 'default') ? 'chrome://bbsfox2' : 'telnet://' + this.siteaddr;
      try {
        var logins = Components.classes["@mozilla.org/login-manager;1"].getService(Components.interfaces.nsILoginManager).findLogins({}, url, 'chrome://bbsfox2', null);
        if(logins.length)
        {
          this.values['Login'] = logins[0]['username'];
          this.values['Passwd'] = logins[0]['password'];
        }
        else
        {
          this.values['Login'] = '';
          this.values['Passwd'] = '';
        }
      } catch(e) {
        this.values['Login'] = '';
        this.values['Passwd'] = '';
      }
      */
      //load login data - end
  },

  setToPref: function() {
      var opt = this.opt;
      for(var i in opt.valueBool){
        this.setPrefBool(opt.valueBool[i]);
      }
      for(var i in opt.valueInte){
        this.setPrefInte(opt.valueInte[i]);
      }
      for(var i in opt.valueComp){
        this.setPrefComp(opt.valueComp[i]);
      }
      if(this.sitename=='')
      {
      }
      else
      {
        localStorage['host_' + this.siteaddr+'.sitename'] = this.sitename;
        //this.browserutils.saveSite(this.sitename, this.siteaddr);
      }
      //save login data - start
      /*
      this.delLoginData();
      var url = (this.siteaddr == 'default') ? 'chrome://bbsfox2' : 'telnet://' + this.siteaddr;
      try {
        var myLoginInfo = new Components.Constructor("@mozilla.org/login-manager/loginInfo;1",Components.interfaces.nsILoginInfo,"init");
        var login = new myLoginInfo(url, 'chrome://bbsfox2', null, this.values[opt.valueAccount[0]], this.values[opt.valueAccount[1]], '', '');
        Components.classes["@mozilla.org/login-manager;1"].getService(Components.interfaces.nsILoginManager).addLogin(login);
      } catch(e) {}
      */
      //save login data - end
  },

  /*
  delLoginData: function() {
    //delete login data - start
    var url = (this.siteaddr == 'default') ? 'chrome://bbsfox2' : 'telnet://' + this.siteaddr;
    try {
      var loginManager = Components.classes["@mozilla.org/login-manager;1"].getService(Components.interfaces.nsILoginManager);
      var logins = loginManager.findLogins({}, url, 'chrome://bbsfox2', null);
      for (var i = 0; i < logins.length; i++)
        loginManager.removeLogin(logins[i]);
    } catch(e) {}
    //delete login data - end
  }
  */

  /*
  charsetTest: function() {
    // detect system locale and save to pref
    if(this.prefs.getComplexValue('Charset', Components.interfaces.nsISupportsString).data == 'locale') {
      var PLStr = Components.interfaces.nsIPrefLocalizedString;

      var nsIString = Components.classes["@mozilla.org/supports-string;1"]
                              .createInstance(Components.interfaces.nsISupportsString);
      nsIString.data = this.browserutils._prefBranch.getComplexValue('locale', PLStr).data;
      this.prefs.setComplexValue('Charset', Components.interfaces.nsISupportsString, nsIString);
    }
  }
  */
}

function BBSFoxOptions() {
  this.valueBool = ['haligncenter', 'valigncenter','displayborder'];
  /*
  this.valueBool = ['ask','AutoDbcsDetection','HAlignCenter',
                   'VAlignCenter','LineFeed','LoadUrlInBG',
                   'DetectLink','UseMouseBrowsing','MouseBrowsingHighlight',
                   'MouseBrowsingHandPointer','UseMouseBrowsingEx','MouseBrowseSendEnter',
                   'EPAutoPlay','EPLoop','EPAutoUseHQ',
                   'EPCopyUrlButton','EPWhenDropLink','HokeyForCopy',
                   'HokeyForPaste','HokeyForSelectAll','HokeyForMouseBrowsing',
                   'HokeyForDownloadPost','UseKeyWordTrack','DeleteSpaceWhenCopy',
                   'EmbeddedPlayerMenu','MouseBrowseMenu','OpenAllLinkMenu',
                   'CopyHtmlMenu','ScreenKeyboardMenu','SavePageMenu',
                   'KeyWordTrackMenu','HideBookMarkLinkMenu','HideSendLinkMenu',
                   'HideBookMarkPageMenu','HideSendPageMenu','DelayPasteMenu',
                   'HideViewInfoMenu','UseHttpContextMenu','DownloadPostMenu',
                   'FileIoMenu','PreviewPictureMenu','NotifyWhenBackbround',
                   'NotifyBySound','NotifyByMessage','HideInputBuffer',
                   'DropToPaste','EnablePicturePreview','CtrlPicturePreview',
                   'PicturePreviewInfo','ClearCopiedSel','HokeyForBgDisplay',
                   'SwitchBgDisplayMenu','Hokey2ForPaste','DisplayBorder',
                   'EasyReadingMenu','HokeyForEasyReading','SaveAfterDownload',
                   'EasyReadingWithImg','EasyReadingWithVideo','PushThreadMenu',
                   'NotifyShowContent'];
  */

  this.valueInte = ['bordercolor'];
  /*
  this.valueInte = ['ScreenType','HighlightBG','bbsbox.width',
                   'bbsbox.height','EnterType','FontSize',
                   'AntiIdle.seconds','FGBGcolor','LineWrap',
                   'ReconnectTime','EmbeddedPlayerSize','HotkeyCtrlW','HotkeyCtrlB','HotkeyCtrlL',
                   'ScreenKeyboardAlpha','InputBufferSizeType','DefineInputBufferSize',
                   'PicturePreviewHeight','DownloadLineDelay','HotkeyDownloadType',
                   'MiddleButtonFunction','BackgroundType','BackgroundBrightness',
                   'MouseWheelFunc1','MouseWheelFunc2','MouseWheelFunc3',
                   'BorderColor','PushThreadLineLength'];
  */

  this.valueComp = [];
  /*
  this.valueComp = ['AntiIdle.string','Escape.string','TermType',
                   'Charset','FontFace.string',
                   'PreLoginPrompt','LoginPrompt','PasswdPrompt',
                   'PreLogin',
                   'PostLogin','BackgroundImageMD5'];
  */

  //this.valueAccount = ['Login','Passwd'];

  //this.browserutils = new BBSFoxBrowserUtils();
  //this.prefs = this.browserutils.getSubBranch('host_default.');

  this.allSiteSetting = [];
  this.selectedIndex = 0;
}

BBSFoxOptions.prototype = {

  addSite: function(siteName, siteAddr, newsite) {
    var siteList = document.getElementById('siteListEx');
    var listcellrow = document.createElement('div');
    listcellrow.setAttribute('tabtype','listcellrow');
    listcellrow.setAttribute('site',siteAddr);
    var rowcells = document.createElement('div');
    rowcells.setAttribute('tabtype','rowcells');
    var rowcell1 = document.createElement('div');
    rowcell1.setAttribute('tabtype','rowcell');
    rowcell1.setAttribute('site',siteAddr);
    rowcell1.style.left=0;
    rowcell1.innerHTML = siteName;
    var rowcell2 = document.createElement('div');
    rowcell2.setAttribute('tabtype','rowcell');
    rowcell2.setAttribute('site',siteAddr);
    rowcell2.style.left='126px';
    rowcell2.innerHTML = siteAddr;
    listcellrow.appendChild(rowcells);
    rowcells.appendChild(rowcell1);
    rowcells.appendChild(rowcell2);
    siteList.appendChild(listcellrow);
    rowcell1.setAttribute("onclick","selectSite(this);");
    rowcell2.setAttribute("onclick","selectSite(this);");

    var newsite = new BBSFoxSiteSetting(this, siteAddr, siteName, newsite, listcellrow);
    this.allSiteSetting.push(newsite);
  },

  delSite: function() {
    var siteAddr = null;
    for(var i in this.allSiteSetting)
    {
      if(this.allSiteSetting[i].listcellrow.getAttribute('tabtype') == 'listcellrow-select')
      {
        siteAddr = this.allSiteSetting[i].listcellrow.getAttribute('site');
        var siteList = document.getElementById('siteListEx');
        siteList.removeChild(this.allSiteSetting[i].listcellrow);
        break;
      }
    }
    if(!siteAddr)
      return;
    /*
    var siteList = document.getElementById('siteListEx');
    var siteAddr = siteList.selectedItems[0].childNodes[1].getAttribute('label');
    siteList.removeItemAt(siteList.getIndexOfItem(siteList.selectedItems[0]));
    */
    var temp = [];
    while(this.allSiteSetting.length){
      var site = this.allSiteSetting.shift();
      if(site.siteaddr != siteAddr)
        temp.push(site);
    }

    while(temp.length){
      this.allSiteSetting.push(temp.shift());
    }
    document.getElementById('defaultsiterow').setAttribute('tabtype', 'listcellrow-select');
    document.getElementById('option.btndelsite').disabled = "true";
  },

  getSelectedSite: function() {
    for(var i in this.allSiteSetting)
    {
      if(this.allSiteSetting[i].listcellrow.getAttribute('tabtype') == 'listcellrow-select')
        return this.allSiteSetting[i].listcellrow.getAttribute('site');
    }
    return "";
  },

  siteChanged: function(site) {
    for(var i in this.allSiteSetting)
    {
      if(this.allSiteSetting[i].listcellrow.getAttribute('site')==site && this.allSiteSetting[i].listcellrow.getAttribute('tabtype') == 'listcellrow-select')
        return false;
    }

    for(var i in this.allSiteSetting)
      this.allSiteSetting[i].listcellrow.setAttribute('tabtype','listcellrow');

    for(var i in this.allSiteSetting){
      if(this.allSiteSetting[i].listcellrow.getAttribute('site')==site)
      {
      	siteIndex = i;
        this.allSiteSetting[i].listcellrow.setAttribute('tabtype','listcellrow-select');
        break;
      }
    }

    /*
    var siteList = document.getElementById('siteListEx');
    if(siteList.selectedItems[0])
    {
    }
    else
    {
      siteList.selectItem(siteList.getItemAtIndex(0));
      return;
    }
    */

    //save prevous page value
    this.allSiteSetting[this.selectedIndex].getFromUi();

    //var siteIndex = siteList.getIndexOfItem(siteList.selectedItems[0]);
    this.selectedIndex = siteIndex

    //load new page value
    document.getElementById('option.btndelsite').disabled = (siteIndex==0) ? "true" : "";
    this.allSiteSetting[this.selectedIndex].setToUi();

    return true;
  },

  onFontChange:function() {
      if(document.getElementById("FontFace.string").value=='')
      {
        document.getElementById("FontTestResult").style.display = 'none';
        return;
      }
      var strBundle = document.getElementById("bbsfoxoptions-string-bundle");
      var s0 = document.getElementById("FontFaceTest.span0");
      var s1 = document.getElementById("FontFaceTest.span1");
      var s2 = document.getElementById("FontFaceTest.span2");
      var s3 = document.getElementById("FontFaceTest.span3");
      var s4 = document.getElementById("FontFaceTest.span4");
      var s5 = document.getElementById("FontFaceTest.span5");
      var s9 = document.getElementById("FontTestResult");

      var fontface = document.getElementById("FontFace.string").value;
      var idx = fontface.indexOf('(');
      if(idx!=-1)
        fontface = fontface.substring(0,idx);

      if(fontface =='Fixedsys')
      {
        s9.style.display = 'inline';
        s9.style.color ="#FF0000";
        s9.value = strBundle.getString('fontTestResult3');
        return;
      }

      s0.style.fontFamily = fontface;
      s1.style.fontFamily = fontface;
      s2.style.fontFamily = fontface;
      s3.style.fontFamily = fontface;
      s4.style.fontFamily = fontface;
      s5.style.fontFamily = fontface;

      s0.style.fontSize = "48px";
      s1.style.fontSize = "48px";
      s2.style.fontSize = "48px";
      s3.style.fontSize = "48px";
      s4.style.fontSize = "48px";
      s5.style.fontSize = "48px";

      var w0 = s0.offsetWidth;
      var w1 = s1.offsetWidth;
      var w2 = s2.offsetWidth;
      var w3 = s3.offsetWidth;
      var w4 = s4.offsetWidth;
      var w5 = s5.offsetWidth;

      if(w0==w1 && w1==w2 && w2==w3 && w3==w4 && w4==w5)
      {
        s9.style.display = 'inline';
        s9.style.color ="#0000FF";
        s9.value = strBundle.getString('fontTestResult1');
      }
      else if(w1==w2 && w2==w3 && w3==w4 && w4==w5)
      {
        s9.style.display = 'inline';
        s9.style.color ="#FF0000";
        s9.value = strBundle.getString('fontTestResult4');
      }
      else if(w2==w3 && w3==w4 && w4==w5)
      {
        s9.style.display = 'inline';
        s9.style.color ="#FF0000";
        s9.value = strBundle.getString('fontTestResult2');
      }
      else
      {
        s9.style.display = 'inline';
        s9.style.color ="#FF0000";
        s9.value = strBundle.getString('fontTestResult3');
      }
  },

  charsetChange:function() {
    // build font lists
    /*
    if(document.getElementById('Charset').value == 'gb2312')
      var lang = 'zh-CN';
    else
      var lang = 'zh-TW';
    var fontFace = document.getElementById('FontFace.string');
    var fontFaceEn = document.getElementById('FontFaceEn.string');
    FontBuilder.buildFontList(lang, 'monospace', fontFace);
    FontBuilder.buildFontList(lang, 'monospace', fontFaceEn);
    //
    var siteList = document.getElementById('siteListEx');
    var siteIndex = 0;
    if(siteList.selectedItems[0])
      siteIndex = siteList.getIndexOfItem(siteList.selectedItems[0]);

    document.getElementById('FontFace.string').value = this.allSiteSetting[siteIndex].values['FontFace.string'];
    document.getElementById('FontFaceEn.string').value = this.allSiteSetting[siteIndex].values['FontFaceEn.string'];
    */
  },

  getSiteAddrList: function() {
    var siteAddrList = localStorage["option.SiteAddrList"];
    if(siteAddrList)
      return siteAddrList.split("/");
    return [];
  },

  delSiteFromeAddrList: function(siteAddr) {
    /*
    var siteAddrList = localStorage["option.SiteAddrList"];
    var siteAddrList2 = [];
    var siteAddrList3 = [];
    var siteAddrList4 = "";
    if(siteAddrList)
    {
      siteAddrList2 = siteAddrList.split("/");
      for(var i=0;i<siteAddrList2.length();++i);
      {
        if(siteAddrList2[i]==siteAddr)
        {
        }
        else
        {
          siteAddrList3.push(siteAddrList2[i]);
        }
      }
      for(var i=0;i<siteAddrList3.length();++i);
      {
        if(siteAddrList4!="")
          siteAddrList4+=("/"+siteAddrList3[i]);
        else
          siteAddrList4+=siteAddrList3[i];
      }
    }
    localStorage["option.SiteAddrList"]=siteAddrList4;
    */
  },

  load: function() {
    //load default setting.
    var siteAddrList = this.getSiteAddrList();
    var subBranch = 'default';
    var defaultSiteSetting = new BBSFoxSiteSetting(this, subBranch, '', false);
    this.allSiteSetting.push(defaultSiteSetting);

    var siteList = document.getElementById('siteListEx');
    //var CiStr = Components.interfaces.nsISupportsString;
    for(var i=0; i<siteAddrList.length; ++i)
    {
    	var sitename = localStorage['host_' + siteAddrList[i]+'.sitename'];
    	this.addSite(sitename, siteAddrList[i], false);
    	/*
      var row = document.createElement('listitem');
      var cell = document.createElement('listcell');
      //var sitename = this.browserutils.getSubBranch('host_' + siteAddrList[i]+'.').getComplexValue('sitename', CiStr).data;
      var sitename = localStorage['host_' + siteAddrList[i]+'.sitename'];
      cell.setAttribute('label', sitename);
      row.appendChild(cell);

      cell = document.createElement('listcell');
      cell.setAttribute('label', siteAddrList[i]);
      row.appendChild(cell);

      siteList.appendChild(row);
      var othersite = new BBSFoxSiteSetting(this, siteAddrList[i], sitename, false);
      this.allSiteSetting.push(othersite);
      alert("2 "+this.allSiteSetting.length);
      */
    }
    defaultSiteSetting.setToUi();
  },

  save: function() {

    //var siteList = document.getElementById('siteListEx');
    //var siteIndex = 0;
    //if(siteList.selectedItems[0])
    //  siteIndex = siteList.getIndexOfItem(siteList.selectedItems[0]);
    //this.allSiteSetting[siteIndex].getFromUi();
    //find now selected site, do: getFromUi();

    for(var i in this.allSiteSetting)
    {
      if(this.allSiteSetting[i].listcellrow.getAttribute('tabtype') == 'listcellrow-select')
      {
        this.allSiteSetting[i].getFromUi();
        break;
      }
    }

    var siteAddrListStr = "";
    for(var i in this.allSiteSetting){
      this.allSiteSetting[i].setToPref();
      if(this.allSiteSetting[i].siteaddr!='default')
      {
        if(siteAddrListStr!="")
          siteAddrListStr+=("/"+this.allSiteSetting[i].siteaddr);
        else
          siteAddrListStr+=this.allSiteSetting[i].siteaddr;
      }
    }
    localStorage["option.SiteAddrList"]=siteAddrListStr;
  },

  cancel: function() {
  },

  setDefault: function() {
    /*
    //set all ui item to default value.
    //var item = document.getElementById('ScreenType');
    //alert(item.getAttribute('bbsDefaultValue'));
    var item = null;
    for(var i in this.valueBool){
      item = document.getElementById(this.valueBool[i]);
      if(item)
        item.checked = (item.getAttribute('bbsfoxDefaultValue')=='true');
    }
    for(var i in this.valueInte){
      item = document.getElementById(this.valueInte[i]);
      if(item)
        item.value = item.getAttribute('bbsfoxDefaultValue');
    }
    for(var i in this.valueComp){
      item = document.getElementById(this.valueComp[i]);
      if(item)
        item.value = item.getAttribute('bbsfoxDefaultValue');
    }
    this.charsetChange();
    */
  },

  checkPref: function() {
    //if we can't find site from list, we must delete site pref...
    //var siteList = document.getElementById('siteListEx');
    var nowSiteAddrList = this.getSiteAddrList();
    for(var j=0;j<nowSiteAddrList.length;++j)
    {
      var findflag = false;
      for(var i in this.allSiteSetting)
      {
      //if(this.allSiteSetting[i].listcellrow.getAttribute('tabtype') == 'listcellrow-select')
      //for(var i=1;i<siteList.itemCount;++i)
      //  var listitem = siteList.getItemAtIndex(i);
        var siteAddr = this.allSiteSetting[i].siteaddr;
        if(siteAddr==nowSiteAddrList[j]) //found !
        {
          findflag = true;
          break;
        }
      }
      if(!findflag)
      {
        //delete saved login data - start
        /*
        var url = 'telnet://' + nowSiteAddrList[j];
        try {
          var loginManager = Components.classes["@mozilla.org/login-manager;1"].getService(Components.interfaces.nsILoginManager);
          var logins = loginManager.findLogins({}, url, 'chrome://bbsfox2', null);
          for (var i = 0; i < logins.length; i++)
            loginManager.removeLogin(logins[i]);
        } catch(e) {}
        */
        //delete saved login data - end
        this.delSiteFromeAddrList(nowSiteAddrList[j]);
      }
    }
  },
  notifyPage: function() {
    /*
      //notify page to check pref...
      var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
                     .getService(Components.interfaces.nsIWindowMediator);

      var browserEnumerator = wm.getEnumerator("navigator:browser");
      while (browserEnumerator.hasMoreElements())
      {
        var browserInstance = browserEnumerator.getNext().getBrowser();

        var numTabs = browserInstance.tabContainer.childNodes.length;
        for(var index=0; index<numTabs; index++) {
          var currentBrowser = browserInstance.getBrowserAtIndex(index);
          var urlstr = currentBrowser.currentURI.spec;
          var urllen = urlstr.length;
          if(urllen>9)
          {
            var urlheader = urlstr.substr(0,9);
            if(urlheader.toLowerCase()=="telnet://")
            {
              var doc = currentBrowser.contentDocument;
              if (doc) {
                var cmdhandler = doc.getElementById('cmdHandler');
                if (cmdhandler && "createEvent" in doc) {
                  cmdhandler.setAttribute('bbsfoxCommand', 'checkPrefExist');
                  var evt = doc.createEvent("Events");
                  evt.initEvent("OverlayCommand", false, false);
                  cmdhandler.dispatchEvent(evt);
                }
              }
            }
            else
            {
            }
          }
          else
          {
          }
        }
      }
    */
  }
}

